<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	/**
	 * @author 朱明强
	 * @since 2009/05/22
	 */

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>聋校备课与语言学习及矫治系统</title>
<fmt:setBundle basename="PathResource" scope="session" />
<link href="<%=request.getContextPath() %>/<fmt:message key='StylePath' />style2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	left:570px;
	top:19px;
	width:22px;
	height:22px;
	z-index:1;
}
-->
</style>
<script type="text/javascript" src="<%=request.getContextPath()%>/<fmt:message key='jquery' />jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/<fmt:message key='jquery' />jquery.boxy.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/<fmt:message key='jquery' />ajaxHelper.js"></script>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function ChangeWindows()
{
   if(parent.document.all.yxmains.cols=="203,*,167")
   {
      parent.document.all.yxmains.cols="0,*,0";
     <!-- parent.document.all.yxtops.rows="*,0";-->
      document.getElementById("Image5").src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/exit.gif";
       document.getElementById("cthid").height=screen.availHeight-210;
   }
   else
   {
       parent.document.all.yxmains.cols="203,*,167";
       <!--parent.document.all.yxtops.rows="654,*";-->
       document.getElementById("Image5").src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/full.gif";
        document.getElementById("cthid").height=560;
   }
}
var leftWindow;
var rightWindow;
var evaluateText="";//评分文本 语音控件需要
var per_f = 80;//气球爆炸极限百分比
var difficulty_f = 30;//游戏难度系数
//lifecycle method begin ########################################
function prePlayGame(){
	difficulty_f = leftWindow.getGameLevel();
	evaluateText = rightWindow.getEvaluateText();
	if(!ExternalInterfaceExample){
		alert("页面初始化错误！请刷新页面或重新进入页面！");
		return false;
	}
	if(evaluateText=="") {
		alert("请先选择矫治内容！");
		return false;
	}
	if(rightWindow.getGameId()==""){
		alert("选择的游戏信息已丢失,请重新选择游戏！");
		return false;
	}
	//thisMovie("ExternalInterfaceExample").per_f(per_f);
	thisMovie("ExternalInterfaceExample").per_f(difficulty_f);
	return true;
	
}
function startEvaluate(){
	t_ocx.SetParamer("interval", "20");
	var jastDataType = rightWindow.getGameTypeJustDataType();
	if(jastDataType && jastDataType!=''){
		t_ocx.SetParamer ("datatype",jastDataType);//'10'为实时波形数据
	}
	t_ocx.SetDeviceVolume(80,true);
	t_ocx.StartRecord();
}
function suspendEvaluate(){
	t_ocx.PauseRecord();
}
function restartEvaluate(){
	t_ocx.RestartRecord();
}
function finishedEvaluate(result){
	alert(result);
	t_ocx.StopRecord();
	
	var dialogContent = "<div style=\"float:right;width:300px;display:none;border:0px ;\">游戏得分：" + result +" 分"+ getDialogCloseSource() + "</div>";
	var dialog = getModalDialog(dialogContent,"游戏结果");
	var _url = "<%=request.getContextPath()%>/game.do?method=saveGameResult";
	var params = "gameLevel="+(difficulty_f/30-1)+"&score="+result;
	params+= "&studentID="+rightWindow.getStudentId();
	params+= "&gameID="+rightWindow.getGameId();
	params+= "&bookID="+rightWindow.getCurrentBookId();
	$.ajax({
		url:_url,
		type: 'POST',
		timeout: 20000,//超时时间设定
		data:params,//参数设置
		error: function(){alert('error');},//错误处理，隐藏进度条
		success: function(html){
		},
		complete: function(){
			leftWindow.location = leftWindow.location;
		}
		
	});
	
}
//lifecycle method end ########################################
function getModalDialog(content,title){
	var dialog = top.eval("new Boxy('"+content+"',{title:'"+title+"',unloadOnHide:true,closeable:false,modal:true});");
	return dialog;
}
function addFlashToCenter(id){
	var html = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" id=\"ExternalInterfaceExample\" width=\"600\" height=\"500\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\">";
	html += "<param name=\"movie\" value=\"<%=request.getContextPath() %>/game.do?method=dowloadGame&gameID="+id+"\" />";
	html += "<param name=\"quality\" value=\"high\" />";
	html += "<param name=\"bgcolor\" value=\"#869ca7\" />";
	html += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	html += "<param name=\"wmode\" value=\"transparent\" />";
	html += "<embed src=\"<%=request.getContextPath() %>/game.do?method=dowloadGame&gameID="+id+"\" quality=\"high\" bgcolor=\"#869ca7\" width=\"600\" height=\"500\" name=\"ExternalInterfaceExample\" align=\"middle\" play=\"true\" loop=\"false\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">"
	html += "</embed></object>";
	document.getElementById("content").innerHTML=html;
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    } else {
        return document[movieName];
    }
}
function init(){
	leftWindow = self.parent.frames["left"];
	rightWindow = self.parent.frames["right"];
}
//-->
</script>
<script for="t_ocx" event=SpeechData(data) type="text/javascript">
	//$("#console").append("<p>"+data+" </p>");
	thisMovie("ExternalInterfaceExample").sendToActionScript(data);
</script>
<script FOR=t_ocx EVENT=IsVoiceData(data) type="text/javascript">
	thisMovie("ExternalInterfaceExample").sendToActionScript(data);
</script>
</head>

<body class="center_style2" onload="MM_preloadImages('<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/exit.gif');init();" bgcolor="#ccea68">
<!--  <div id="console" style="width:100%;height:100px;overflow: auto;border:1px solid red">
&nbsp;
</div>-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="700" align="left" valign="top" background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/ktyx/center_bg.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="600" align="left" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="14" height="15" align="right" valign="bottom"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_01.gif" width="14" height="15" /></td>
            <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_06.gif">&nbsp;</td>
            <td width="14" height="15" align="left" valign="bottom"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_02.gif" width="14" height="15" /></td>
          </tr>
          <tr>
            <td id="cthid" height="560" background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_05.gif">&nbsp;</td>
            <td align="center" valign="middle" bgcolor="#FFFFFF">
				<div id="apDiv1" style="POSITION: absolute; TOP:20px; left:10px;">
					<a href="#" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/full.gif" name="Image5" border="0" id="Image5" onclick="ChangeWindows()" /></a>
				</div>
				<div id="content" style="width:100%;height:100%;z-index: -999;"></div>
			</td>
            <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_08.gif">&nbsp;</td>
          </tr>
          <tr>
            <td width="14" height="15" align="right" valign="top"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_03.gif" width="14" height="15" /></td>
            <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_07.gif">&nbsp;</td>
            <td width="14" height="15" align="left" valign="top"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />jz_img/jzxx/center_04.gif" width="14" height="15" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="100" align="center" valign="top">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>

<object id="t_ocx" width=0 height=0 classid="CLSID:BAAA7FE8-09E2-4011-9333-C6DFC8D9749D" codebase="<%=request.getContextPath()%>/<fmt:message key='common' />ThinkIT_ChinaDeaf.ocx">
    <param name="_Version" value="65536"/>
    <param name="_ExtentX" value="2646"/>
    <param name="_ExtentY" value="1323"/>
    <param name="_StockProps" value="0"/>
</object>
</body>
</html>
